import { defineStore } from "pinia";

export const useUser = defineStore("user", {
  state: () => ({
    userInfo: JSON.parse(sessionStorage.getItem("userInfo")) || {
      username: "",
      name: "",
      gender: "male",
      class: "",
      phone: "",
      age: "",
      password: '',
    },
  }),
  actions: {
    SET_USER_INFO(data) {
      this.userInfo = data;
      sessionStorage.setItem("userInfo", JSON.stringify(data))
    },
  },
});
